<!DOCTYPE html PUBLIC>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="$!webPath/css/template.css" rel="stylesheet" type="text/css"/>
    <link href="$!webPath/css/jquery-ui-1.8.22.custom.css" type="text/css" rel="stylesheet">
    <script src="$!webPath/js/jquery-1.6.2.js"></script>
    <script src="$!webPath/js/jquery-ui-1.8.21.js"></script>
    <script src="$!webPath/js/ajaxfileupload.js"></script>
    <script src="$!webPath/js/jquery.form1.js"></script>
    <style type="text/css">
        label.error {
            color: #F00;
            margin-left: 3px;
        }

        input.error {
            border: 2px solid #F00;
        }
    </style>
</head>
<body>
<div class="header_nav">
    <iframe name="content_frame" src="$!webPath/admin/nav" marginwidth=0 marginheight=0  frameborder=0 width=100% height=80/></iframe>
    <div class="cont_right"><a href="$!webPath/login">注销</a></div>
</div>
<div class="cont">
    <h3 class="seth">编辑</h3>
    <div class="nav_list">
        <ul id="ul_table">
            <li><a href="$!webPath/admin/Article_list?size=10&page=0"><b>文章列表</b></a></li>
            <li><a href="javascript:void(0);" class="this"><b>编辑</b></a></li>
        </ul>
    </div>
    <div class="adddetail">
        <form method="post" name="theForm" id="theForm"  enctype="multipart/form-data">

            <div class="edit">
                <div class="setcont editul">
                    <ul class="set1">
                        <li class="setcont_bg">文章位置</li>
                        <li>
                            <input name="articlePath" id="articlePath" type="text" value="$!articleEntity.articlePath" size="30">
                            <!--<select name="articlePath" id="articlePath">-->
                                <!--<option value="">用户服务协议</option>-->
                                <!--<option value="">积分赛事规则</option>-->
                                <!--<option value="">系列赛事规则</option>-->
                                <!--<option value="">战队规则</option>-->
                                <!--<option value="">职业战队规则</option>-->
                            <!--</select>-->
                        </li>
                    </ul>
                    <ul class="set1">
                        <li class="setcont_bg">文章标题</li>
                        <li>
                            <input name="title" id="title" type="text" value="$!articleEntity.title" size="30">
                        </li>
                    </ul>
                    <ul class="set1">
                        <li class="setcont_bg">文章状态</li>
                        <li>
                            #if($!articleEntity.status==0)
                                <input type="radio" name="status" value="0" checked>未启用
                                <input type="radio" name="status" value="1">启用
                            #elseif($!articleEntity.status==1)
                            <input type="radio" name="status" value="0">未启用
                            <input type="radio" name="status" value="1" checked>启用
                            #else
                            <input type="radio" name="status" value="0">未启用
                            <input type="radio" name="status" value="1">启用
                            #end
                        </li>
                    </ul>
                    <ul class="set1">
                        <li class="setcont_bg">文章简介</li>
                        <li>
                            <textarea name="articleShortContent" id="articleShortContent">
                                $!articleEntity.articleShortContent
                            </textarea>
                        </li>
                    </ul>
                    <ul class="set1">
                        <li class="setcont_bg">文章内容</li>
                        <li>
                            <textarea name="content" id="content">
                                $!articleEntity.content
                            </textarea>
                        </li>
                    </ul>
                    <ul class="set1">
                        <li class="setcont_bg">文章描述</li>
                        <li>
                            <textarea name="articleDescription" id="articleDescription">
                                $!articleEntity.articleDescription
                            </textarea>
                        </li>
                    </ul>
                    <ul class="set1">
                        <li class="setcont_bg"></li>
                        <li>
                            <!--商品图片上传 -->
                            <div class="tab_body" style="width: 500px">
                                <ul class="tabbody_ul">
                                    <li class="this">图</li>
                                </ul>
                                <div class="tabbodys" style="width: 498px;">
                                    <div class="tab_body_b" style="width: 500px;"></div>
                                    <div class="tab_body_a" style="width: 500px;">
                                        <div class="upload_pictures">
                                            <div class="upload_pictures_top">
                                                <div class="upload_pictures_top_img">
                                                    #if($obj.picture_url&&$obj.picture_url!="")
                                                    <img src="" />
                                                    #else
                                                    <img src="" />
                                                    #end
                                                </div>
                                            </div>
                                            <div class="upload_pictures_bottom">
                                                <ul>
                                                    <input type="hidden" name="pictureName" id="pictureName"/>
                                                    <input type="file" id="goodsPhoto" name="photo" style="opacity:1;position: static;" accept="image/jpg,image/jpeg,image/png">
                                                </ul>
                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>


        </form>
        <div class="submit">
        <span class="pad120">
    <input name="save" type="button" value="提交" id="saveForm">
    </span>
        </div>
    </div>
</div>
<script>
    $('#saveForm').click(function(){
        var title=$('#title').val();
        var articlePath=$('#articlePath').val();
        var status=$('input[name="status"]:checked').val();
        var articleShortContent=$('#articleShortContent').val();
        var content=$('#content').val();
        var articleDescription=$('#articleDescription').val();
        if(title==''||articlePath==''||status==''||articleShortContent==''||content==''||articleDescription==''){
            alert('每一项都不能为空');
        }
        $("#theForm").ajaxSubmit({
            url : "$!webPath/admin/save_article",
            type : "post",
            success : function(data) {
                window.location.href = "$!webPath/admin/Article_list?size=10&page=0";
            },
            error : function(data) {
                alert('失败');
            }
        });
    })
</script>
</body>
</html>
